<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
    <title>极目云医</title>
    <%@include file="/WEB-INF/views/include/head.jsp" %>
</head>
<body>
<%@include file="/WEB-INF/views/include/tail.jsp" %>
<script type="text/javascript">
    flag=true;
    /**
     *保存医保对照
     * @param divId
     * @param formId
     * @param url
     * @param hrefUrl
     */
    function saveVsMedical(){
        if ($('#inputForm').parsley().validate()) {
            var url='${ctx}/med/hisVsMedical/save';
            url=timestamp(url);
            if (flag) {
                flag = false;
                $("#inputForm").ajaxSubmit({
                    type: 'post', // 提交方式 get/post
                    url:url, // 需要提交的 url
                    success: function(data) { // data 保存提交后返回的数据，一般为 json 数据
                        if (data.code == "success") {
                            parent.closeLayer();
                            parent.toastr.success(data.data);
                        } else if(data.code == 'info'){
                            parent.toastr.success(data.data);
                        } else {
                            flag = true;
                            parent.toastr.error(data.data);
                        }
                    }
                });
            }
            return false;
        }
        return false;
    }
    $(document).ready(function () {
        //项目名称自动补全
        autoCompleteClinic("itemNameMed");
        function autoCompleteClinic(inputId) {
            $("#"+inputId).flushCache();
            var url = "${ctx}/med/hisVsMedical/automatic";
            autoComplete(inputId, url,
                    function (data) {
                        var rows = [];
                        for (var i = 0; i < data.length; i++) {
                            rows[rows.length] = {
                                data: data[i],
                                value: data[i].id,
                                result: data[i].drug_name
                            };
                        }
                        return rows;
                    }, function (data, i, max) {
                        return "类别："+data.drug_class+"<br>编码："+data.drug_code+"<br>名称："+data.drug_name+"<br>单位："+data.units+"<br>规格："+data.spec+"<br>剂型："+data.drug_form+"<br>医保类别："+data.item_gtade;
                    }, function (event, data, formatted) {
                        $("#itemNameMed").val(data.drug_name);
                        $("#itemClassMed").val(data.drug_class);
                        $("#itemCodeMed").val(data.drug_code);
                        $("#specMed").val(data.spec);
                        $("#unitsMed").val(data.units);
                        $("#medicalId").val(data.id);
                        $("#remarks").val(data.item_gtade);
                        $("#medicalType").val(data.charge_type);
                    })
        }

    });

</script>
<div class="content-wrap">
        <div class="wrapper" style="bottom: 50px;">
            <section class="panel panel-default">
                <div class="panel-body">

                        <form:form id="inputForm" data-parsley-validate="" modelAttribute="hisVsMedical" method="post" class="form-horizontal">
                            <form:hidden path="id"/>
                            <form:hidden path="priceId"/><%--价表id--%>
                            <form:hidden path="medicalId"/><%--价表id--%>
                            <form:hidden path="medicalType"/><%--医保类别--%>
                            <form:hidden path="province"/><%--省份--%>
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <label class="col-sm-5 control-label">项目名称：</label>
                                    <div class="col-sm-7">
                                        <form:input path="itemNameHis" htmlEscape="false" class="form-control" readonly="readonly" maxlength="100" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-5 control-label">项目类别：</label>
                                    <div class="col-sm-7">
                                        <form:input path="itemClassHis" htmlEscape="false" class="form-control" readonly="true"  maxlength="10" />
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-5 control-label">项目代码：</label>
                                    <div class="col-sm-7">
                                        <form:input path="itemCodeHis" htmlEscape="false" class="form-control" disabled="true" maxlength="50" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-5 control-label">项目规格：</label>
                                    <div class="col-sm-7">
                                        <form:input path="itemSpecHis" htmlEscape="false" class="form-control" readonly="true" maxlength="50" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-5 control-label">项目单位：</label>
                                    <div class="col-sm-7">
                                        <form:input path="itemUnits" htmlEscape="false" class="form-control" readonly="true"  maxlength="20" />
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <label class="col-sm-5 control-label">医保项目名称：</label>
                                    <div class="col-sm-7">
                                        <form:input path="itemNameMed" htmlEscape="false" class="form-control" maxlength="100"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-5 control-label">医保项目类别：</label>
                                    <div class="col-sm-7">
                                        <form:input path="itemClassMed" htmlEscape="false" class="form-control"  maxlength="10" readonly="true" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-5 control-label">医保项目代码：</label>
                                    <div class="col-sm-7">
                                        <form:input path="itemCodeMed" htmlEscape="false" class="form-control" readonly="true" maxlength="50" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-5 control-label">医保项目规格：</label>
                                    <div class="col-sm-7">
                                        <form:input path="specMed" htmlEscape="false" class="form-control" readonly="true" maxlength="50" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-5 control-label">医保项目单位：</label>
                                    <div class="col-sm-7">
                                        <form:input path="unitsMed" htmlEscape="false" class="form-control" readonly="true" maxlength="50" />
                                    </div>
                                </div>
                            </div>
                        </form:form>
                    </div>
            </section>
        </div>
    </div>

</body>
</html>